<?php
/*
 * 公司类
 */
namespace Home\Logic;

class CompanyLogic{
	 public function __construct() {
        $this->c = D('Companies');
    }

	public function insterCompany($data){
		return  $this->c->add($data);
	}

	public function updateCompany($data){
		return $this->c->where(array('id'=>$data['id']))->save($data);
	}

	public function getCompanyByUserId(){
		return  $this->c->where(array('user_id'=>$_SESSION['id']))->find();
	}

	public function getCompanyById($id){
		return $this->c->where(array('id'=>$id))->find();
	}
}